1. Field of the Invention
The present invention relates to a coding and decoding method of a digital image data and an apparatus thereof, and more particularly to a variable length coding/decoding method of an image data and an apparatus thereof which can vary the length of an escape sequence during a variable length coding to thereby reduce the amount of a transmitting data to transmit and similarly to thereafter reduce the amount of received data to decode.
2. Description of the Prior Art
Recently, in order to improve picture quality, a method has become popular an image in which signal is coded and processed by digital data.
However, when an image signal is digitally encoded, the amount of data become voluminous.
Therefore, encoding transformations such as Differential Pulse Code Modulation DPCM, vector quantization, Variable Length Coding and the like are performed in order to reduce the large amount of data by removing redundant data contained in the digital image signal.
FIG.1 is a block diagram for schematically illustrating a conventional digital signal coding apparatus, the apparatus comprising the means for: performing a transform by Discrete Cosine Transform DCT method on an N.times.N block to thereby quantize a transform coefficient; performing a variable length coding on quantized data to thereby compress the data amount substantially; and performing an inverse quantization and inverse transform on the quantized data to thereby perform a motion compensation.
In FIG. 1, the image signal is input through an input terminal 10 and is transformed to a signal of a frequency region on an N.times.N block unit at an N.times.N transform unit 11 and an energy of coefficient thus transformed is mainly gathered towards low frequency components.
A data transformation is performed on each block by methods such as a DCT, Walsh-Hadamard Transform WHT, Discrete Fourier Transform DFT, Discrete Sine Transform and the like.
A quantization unit 12 transforms the transform coefficients to representative values of certain levels through a predetermined quantization process.
A variable length coding unit 13 based on statistical characteristics of the representative values, performs the variable length coding, so that the data can be markedly compressed.
Meanwhile, in accordance with a state of a buffer 14 where a variable-length-coded data is stored, a transformed quantization step size Qss controls the quantization unit to thereby adjust a transmission bit ratio. The quantization step size Qss can be transmitted to a receiving end to thereby be utilized by a decoding apparatus.
Furtheremore, because there are usually many similarities between portions of screens, and in the case of a screen containing motion, the motion is estimated to thereby calculate a vector thereof, and if a data is compensated by utilizing the vector, and because a difference signal between neighboring screens is very small, the transmission data can be substantially compressed.
In order to perform a motion compensation, an inverse quantization unit 15 and an N.times.N inverse transform unit 16 in FIG. 1 perform an inverse quantization on the quantized data output from the quantization unit 12 to thereafter inversely transform the same, so that the same can be transformed to an image signal within a spatial region.
The image signal output from the inverse transform unit 16 is stored per frame unit on a frame memory 17 and a motion estimating unit 18 seeks a block pattern most similar to the N.times.N block data of the input terminal 10 from the frame data stored in the frame memory 17 to thereby calculate a motion vector MV representing a motion between the two blocks.
The motion vector is transmitted to the receiving end to thereby be utilized by a decoding apparatus and at the same time to thereby be transmitted to a motion compensating unit 19.
The motion compensating unit 19 receives the motion vector MV from a motion estimating unit 18 and reads out an N.times.N block corresponding to the motion vector MV from a prior frame data outputted from the frame memory 17 to thereby supply the same to an adder A1 connected to the input terminal 10.
Then, the adder A1 calculates a difference between an N.times.N block supplied to the input terminal 10 and an N.times.N block of similar pattern supplied from the motion compensating unit 19, and the output data of the adder A1 is coded to thereby be transmitted to the receiving end.
In other words, at first, the whole image signals are transmitted and then only a difference signal corresponding to the motion, is transmitted.
Meanwhile, the data whose motion has been compensated at the motion compensating unit 19 is added together with the image signal output to the N.times.N inverse transform unit 16 by an adder A2 and this sum is stored on the frame memory 17.
A refresh switch (not shown) is occasionally rendered off by a control means, and because the input image signal is coded by Pulse-Count Modulation PCM mode to thereby be transmitted, only the difference signal is coded, so that an accumulation of codes resulting from the transmission can be refreshed after a predetermined time interval and a transmission error on a channel can be removed at the receiving end within a predetermined period of time.
In this manner, the coded image data is transmitted to the receiving end to thereby be input to the decoding apparatus as indicated in FIG. 2.
The coded image data is decoded at a variable length decoding unit 21 via an inverse coding process.
The data input from the variable length decoding unit 21 is inversely quantized at an inverse quantization unit 22.
Within the inverse quantization unit 22, the magnitude of an output transform coefficient is adjusted by the quantization step size Qss supplied from the coding apparatus.
An N.times.N inverse transform unit 23 transforms a frequency region transform coefficient supplied from the inverse quantization unit 22 into image data within a spatial region.
Furthermore, the motion vector MV transmitted from the coding apparatus as illustrated in FIG. 1 is supplied to a motion compensating unit 24 of the decoding apparatus, which reads out an N.times.N block corresponding to the motion vector MV from a frame data stored on a frame memory 25 to thereafter compensate for the motion and to thereby supply the same to an adder A3.
Then, the adder A3 adds an inversly transformed DPCM data to an N.times.N block of data supplied from the motion compensating unit 24 to thereby output the same to a display unit.
FIGS. 3A-3C are schematic drawings for illustrating a quantization process of an image data.
A sampling of image data of an N.times.N block as indicated in FIG. 3A is tranformed to a transform coefficient of a frequency region as illustrated in FIG. 3B by a DCT and the like.
After the transform coefficient is quantized, the same is scanned in a zig-zag pattern as illustrated in FIG. 3C to thereby be coded in a format.
When the N.times.N block is scanned, a low frequency component is started first as illustrated in FIG. 3C and then a high frequency component is scanned to thereby be coded as a "run" and "level" pair.
Here, the "run" corresponds to a number of "0's" existing among the non-zero quantized coefficients of the N.times.N block and the "level" corresponds to an absolute value of the coefficients which are not "0".
By way of example, in the case of an 8.times.8 block, the "run" can have a value ranging from "0" to "63".
The "level" varies according to a data value output from the quantization unit, for example, if a quantization output value is expressed as an integer from "-255" to "+255", the "level" comes to have a value from "1" to "255".
The reference symbols, "+" or "-" are expressed by separate sign bits.
As seen from the foregoing, if is utilized as a symbol, and if the Run is large or Level is large, an occurring frequency of the symbols is very low statistically.
Accordingly, as illustrated in FIG. 4, a regular region and escape region are partitioned according to the occurring frequency of the symbols so that a Huffman code is utilized to thereby code the image data for the regular region where the occurring frequency is relatively high, and the image data is coded utilizing an escape sequence for the symbols in the escape region where the occurring frequency is low.
Here, the Huffman code allocates a short-length code when the occurring frequency of symbol is high and a long-length code is allocated when the occurring frequency of symbol is low.
Furthermore, the escape sequence which has coded a data of escape region comprises an escape code ESC, run, level and sign data respectively having predetermined bits as indicated in the following formula (1) EQU Escape Sequence=ESC+RUN+L+S Formula 1
For example, as mentioned in the aforesaid, when the quantized value at the 8.times.8 block ranges "from -255 to 255", the escape sequence has an escape code data ESC of 6-bit, a run data of 6-bit, a level data L of 8-bit and a sign data RUN S of 1-bit, totalling 21-bit of fixed data length.
In this way, in a conventional variable length coding method, various additional information was transmitted along with coded data, and furtheremore because the escape data has a predetermined fixed length, there has been a limit to coding the transmission data to thereby compress the data amount.